package com.yupi.userservice.controller.inner;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yupi.ojsystemcommon.annotation.AuthCheck;
import com.yupi.ojsystemcommon.common.BaseResponse;
import com.yupi.ojsystemcommon.common.DeleteRequest;
import com.yupi.ojsystemcommon.common.ErrorCode;
import com.yupi.ojsystemcommon.common.ResultUtils;
import com.yupi.ojsystemcommon.constant.UserConstant;
import com.yupi.ojsystemcommon.exception.BusinessException;
import com.yupi.ojsystemcommon.exception.ThrowUtils;
import com.yupi.ojsystemmodel.model.dto.user.*;
import com.yupi.ojsystemmodel.model.entity.User;
import com.yupi.ojsystemmodel.model.vo.LoginUserVO;
import com.yupi.ojsystemmodel.model.vo.UserVO;
import com.yupi.serviceclient.service.UserFeignClient;
import com.yupi.userservice.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.List;

import static com.yupi.userservice.service.impl.UserServiceImpl.SALT;


/**
 * 用户接口
 *
 * 
 */
@RestController
@RequestMapping("/inner")
@Slf4j
@Api("用户相关接口")
public class UserInnerController implements UserFeignClient {

    @Resource
    private UserService userService;


    /**
     * 根据id获取用户
     * @param userId
     * @return
     */
    @GetMapping("/get/id")
    public User getById(@RequestParam("userId") long userId){
        return userService.getById(userId);
    }

    /**
     * 根据id获取用户列表
     * @param idList
     * @return
     */
    @GetMapping("/get/ids")
    public List<User>listByIds(@RequestParam("idList") Collection<Long> idList){
        return userService.listByIds(idList);
    }
}
